package com.coc.service;

import com.coc.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class DeptServiceFallBackFactory implements FallbackFactory {


    @Override
    public Object create(Throwable throwable) {
        return new DeptService() {
            @Override
            public Object queryDepts() {
                return null;
            }

            @Override
            public Integer add(Dept dept) {
                return null;
            }

            @Override
            public Integer delete(Integer deptNo) {
                return null;
            }

            @Override
            public Dept selectById(Integer deptNo) {
                return new Dept()
                        .setDeptNo(deptNo)
                        .setName("deptNo->"+deptNo+"没有对应的信息，客户端提供了降级的信息，这个服务现在暂时关闭")
                        .setDbSource("没有数据~");
            }
        };
    }
}
